<#include "admin/template/page/head_lib.html">
	<body>
	<div>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space1">
				<div class="layui-col-md12">
					<blockquote class="layui-elem-quote  " style="padding: 0.5px  5px ">
						<div class="layui-form-query">
							<form class="layui-form" id="query_form">
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-mid">用户名称：</label>
										<div class="layui-input-inline" style="width: 150px;">
											<input type="text" name="user_name" autocomplete="off"
												   class="layui-input" placeholder="请输入用户名称" />
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-mid">身份证：</label>
										<div class="layui-input-inline" style="">
											<input type="text" name="id_card" lay-verify="identity" autocomplete="off" placeholder="请输入身份证号码"
												   class="layui-input"  />
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-mid">手机号：</label>
										<div class="layui-input-inline" style="">
											<input type="text" name="phone" lay-verify="phone"  autocomplete="off" placeholder="请输入手机号"
												   class="layui-input"  />
										</div>
									</div>
									<div class="layui-inline">
										<div class="layui-input-inline">
											<button class="layui-btn" type="button" function="query">
												<i class="layui-icon">&#xe615;</i>查询
											</button>
										</div>
									</div>
								</div>
							</form>
						</div>
					</blockquote>
				</div>
				<div class="layui-col-md12">
					<div class="layui-row grid-demo">
						<div class="layui-col-md12">
							<div class="layui-btn-container">
								<button class="layui-btn  layui-btn-sm layui-btn-danger"
										function="submit" url="system/user/del" isMutiDml="1" isConfirm="1"
										confirmMsg="是否确定删除选中的数据？" inputs="user_id:">
									<i class="layui-icon ">&#xe640;</i> 批量删除
								</button>
								<button class="layui-btn  layui-btn-sm" id="export"
										url="admin/poi/export" >
									<i class="layui-icon">&#xe621;</i> 数据导出
								</button>
								<button class="layui-btn layui-btn-sm" function="refresh" id="refresh">
									<i class="layui-icon">&#x1002;</i> 刷新
								</button>

							</div>
							<table id="adminDatagrid" lay-filter="adminDatagrid"
								   class="adminDatagrid" isLoad="1" url="system/user/query.json"
								   isPage="1" sortType="1" defaultForm="query_form"
								   height="full-130"></table>
							<div class="adminDatagridCols">
								<p type="numbers" title="#" />
								<p checkbox="true" />
								<p field="user_id" title="ID" width="80" />
								<p field="user_name" title="名称" width="120" />
								<p field="id_card" title="身份证" width="180" />
								<p field="phone" title="手机号码" width="140"  />
								<p field="areaname" title="地区" width="180" />
								<p field="address" title="邮寄地址" width="180" />
								<p field="money" title="金钱" width="140"  />
								<p field="state" title="状态" width="140" />
								<p field="remark" title="备注" width="240" />
								<p fixed="right" align="center" toolbar="#barDemo" title="操作"
								   width="174" />
							</div>
							<script type="text/html" id="barDemo">
								<a class="layui-btn layui-btn-xs" lay-event="top" topUrl="f.html?p=system/user/edit.html" topWidth="680px" topHeight=450px" topTitle="编辑用户" inputs="user_id:" id="edit">编辑</a>
							</script>

							<script>
                                layui.use(['upload','layer','jquery','table','form'], function(){
                                    var upload = layui.upload,
                                        layer = layui.layer,
                                        table = layui.table,
                                        form = layui.form,
                                        $ = layui.$;
                                    //执行实例
                                    $(function () {
                                        // 定义到jQuery全局变量下-文件下载
                                        jQuery.download = function (url, method, filedir) {
                                            jQuery('<form action="' + url + '" method="' + (method || 'post') + '">' +  // action请求路径及推送方法
                                                '<input type="text" name="filePath" value="' + filedir + '"/>' + // 文件路径
                                                '</form>')
                                                .appendTo('body').submit().remove();
                                        };
                                        // 导出
                                        $("#export").click(function () {
                                            var user_name = $("input[name='user_name']").val();
                                            var id_card = $("input[name='id_card']").val();
                                            var phone = $("input[name='phone']").val();
                                            $.ajax({
                                                url: 'admin/poi/exportException.json',
                                                type: 'post',
                                                data: {user_name:user_name, id_card:id_card,phone:phone},
                                                dataType: 'json',
                                                success: function (data) {
                                                    var path = data;
                                                    $.download('admin/poi/download.json', 'post', path); // 下载文件
                                                }
                                                ,error: function (data) {
                                                    if (data == 9999){
                                                        layer.msg("导出失败了!");
                                                    }
                                                }
                                            })

                                        })
                                        $("#group").click(function () {
                                            var names = "";
                                            var checkStats = table.checkStatus("adminDatagrid"),
                                                data = checkStats.data;
                                            var json = JSON.stringify(data);
                                            var jsonArray = $.parseJSON(json);
                                            $.each(jsonArray,function (i,item) {
                                                names = names+" "+item.user_name;
                                            })

                                            $("#group").attr("confirmMsg","是否确认发送短信<br>姓名:"+names);
                                        })
                                    })
                                });
							</script>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	</body>
	</html>